define([
    "UtilDir/util",
    "UtilDir/tool",
    "UtilDir/org/selectOrg",
    "UtilDir/searchBlock",
    "Date", "DateCN", "css!DateCss",
    "EasyUI", "EasyUI-lang"
], function (Util, Tool, SelectOrg, SearchBlock) {

    var sysPath = getServer() + "/static/app/fxpg/fxVulnerabilityArea";

    var fxVulnerabilityAreaFormHtml = sysPath + "/views/fxVulnerabilityAreaForm.html";
    var getFxVulnerabilityAreaController = function () {
        return getServer() + "/fx/fxVulnerabilityAreas";
    };
 	var getController = function () {
        return getServer() + "/pc";
    };
    /**
     * 页面初始化
     */
    var init = function () {
        initSearchBlock();
        queryBtnBind();
        createFxVulnerabilityAreaGrid();
        //initAreaSelect();

    };


    var initSearchBlock = function () {
        SearchBlock.init("searchBlock");
    };
    var content = false;
    var queryBtnBind = function () {
    	//编辑
    	$('#edit').on('click', function () {
    		content = true;
    		createFxVulnerabilityAreaGrid();
    	})
    	//保存
    	$('#saveBtn').on('click', function () {
        	debugger;
        	content = false;
        	var params = [];
        	for(let objkey in obj){
			    //console.log(objkey+"----->"+obj[objkey]);
			    // id----->1
				// name----->apple
				// price----->4
				if(objkey.split("=")[2] == "1"){
					var newobj = {
						"taskCode": objkey.split("=")[0],
				      	"divisionCode": objkey.split("=")[1],				      	
				      	"quantity": parseFloat(obj[objkey]).toString()
					}
				}else{
					var newobj = {
						"taskCode": objkey.split("=")[0],
				      	"divisionCode": objkey.split("=")[1],				      	
				      	"percentage": parseFloat(obj[objkey]).toString()
					}
				}				
				params.push(newobj)
			}
	 		//console.log(params)
			debugger
            $.ajax({
                type: "post",
                url: getController()+ '/jobSchedule/update',
                contentType: "application/json",
                data: JSON.stringify(params),
                success: function(res){
                    //保存成功后重新获取表信息
                    obj = {};
                    //console.log(res)
                    Util.alert(res.message);
                    createFxVulnerabilityAreaGrid();
                    
                }
            });


        })
		//上报
        $("#report").click(function () {
            $.ajax({
                type: "post",
                url: getController()+ '/jobSchedule/pcScheduleData',
                contentType: "application/json",
                success: function(res){
                    //console.log(res)
                    Util.alert(res.message);

                }
            });
        });
    };
    // 表格輸入框
 	var obj = {}
 	window.keyup = function(e) {
// 		console.log(e, $(e), $(e).val(), $(e).attr('data-divisionName'))
		var mark = $(e).attr('data-mark');
		debugger
		if(mark == "2"){
			debugger;
			if(!/(^0$)|(^100$)|(^\d{1,2}$)/.test(e.value)) {
	            if(e.value>100){
	                e.value = 100;
	            }
	            if(e.value<0){
	                e.value = 0;
	            }
	        }
		}		
 		var divisionCode = $(e).attr('data-divisionCode')
 		var taskCode = $(e).attr('data-taskCode')
 		
 		var value = $(e).val()

		var subkey = taskCode+"="+divisionCode+"="+mark;
 		
		obj[subkey] = value

 		
 		//console.log(obj)

 	}
 	

    var createFxVulnerabilityAreaGrid = function () {
    	
        $("#fxVulnerabilityAreaGrid").datagrid({
            url: getController() + "/jobSchedule/find",
            method: "GET",
            fitColumns: true,
            autoRowHeight: false,
			nowrap: false,
            //nowrap:false,
//          fit:true,
//          striped: true,
            frozenColumns: [[
                {
                    field: 'divisionName',
                    title: '省份',
                    //rowspan: 3,
                    width: '12%',
                    align: 'center',
                }
	        ]],
            columns: [
//          [
//              {
////                  field: 'earthquakeIntensity',
//                  title: '地震行业普查任务完成情况进度统计表',
//                	colspan: 6,
////                  width: '15%',
//                  align: 'left',
//              },
//
//          ],
            
            [
//              {field: "ck", checkbox: true},
//              {
//                  field: 'area',
//                  title: '省份',
//                  rowspan: 3,
//                  width: '16.6%',
//                  align: 'center',
//              },
               
                {
                    title: '普查任务',
                    colspan: 70,
                    align: 'left',
                },

            ], [
               
                {
                    title: '房屋抽样调查',
                    colspan: 2,
                   	rowspan: 2,
                    align: 'center',
                },
 				{
                    title: '现有地震活断层数据库建设(活断层线)',
                    colspan: 2,
                    rowspan: 2,
                    align: 'center',
                },
                {
                    title: '编制县级 1:5 万活动断层分布图',
                    colspan: 2,
                    rowspan: 2,
                    align: 'center',
                },
                {
                    title: '编制县级 1:5 万活动断层分布图说明书',
                    colspan: 2,
                    rowspan: 2,
                    align: 'center',
                },
                {
                    title: '编制县级 1:5 万活动断层分布图成果报告',
                    colspan: 2,
                    rowspan: 2,
                    align: 'center',
                },
                {
                    title: '地震工程地质条件钻孔基础数据库建设',
                    colspan: 2,
                    rowspan: 2,
                    align: 'center',
                },
                {
                    title: '编制 1:25 万地震构造图',
                    colspan: 2,
                    rowspan: 2,
                    align: 'center',
                },
                {
                    title: '编制1：25万地震构造图说明书',
                    colspan: 2,
                    rowspan: 2,
                    align: 'center',
                },
                {
                    title: '编制1：25万地震构造图成果报告',
                    colspan: 2,
                    rowspan: 2,
                    align: 'center',
                },
                {
                    title: '地震危险性评价图',
                    colspan: 6,
                    align: 'center',
                },
                {
                    title: '房屋建筑、市政设施隐患评估图',
                    colspan: 6,
                    align: 'center',
                },
                {
                    title: '防治区划图（抗震加固优先级）',
                    colspan: 2,
                    align: 'center',
                },
                {
                    title: '防治区划图（活动层避让图）',
                    colspan: 4,
                    align: 'center',
                },
                {
                    title: '全国活动断层图',
                    colspan: 2,
                    align: 'center',
                },
                {
                    title: '不同超越概率地震作用下因房屋破坏导致的直接经济损失风险等级图',
                    colspan: 8,
                    align: 'center',
                },
                {
                    title: '不同超越概率地震作用下因房屋破坏导致的死亡人口风险等级图',
                    colspan: 8,
                    align: 'center',
                },
                {
                    title: '不同超越概率地震作用下因房屋破坏导致的直接经济损失风险评估图',
                    colspan: 8,
                    align: 'center',
                },
                {
                    title: '不同超越概率地震作用下因房屋破坏导致的死亡人口风险评估图',
                    colspan: 8,
                    align: 'center',
                },
            ],[
            	{
            		title: '地震动PGA等值线图',
                    colspan: 2,
                    align: 'center',
            	},
            	{
            		title: '地震危险性等级图（矢量点）',
                    colspan: 2,
                    align: 'center',
            	},
            	{
            		title: '地震危险性等级图（矢量面）',
                    colspan: 2,
                    align: 'center',
            	},
            	{
            		title: '房屋建筑物地震隐患评估图',
                    colspan: 2,
                    align: 'center',
            	},
            	{
            		title: '市政桥梁地震隐患评估图',
                    colspan: 2,
                    align: 'center',
            	},
            	{
            		title: '城市自来水厂地震隐患评估图',
                    colspan: 2,
                    align: 'center',
            	},
            	{
            		title: '地震灾害防治区划图（抗震加固优先级）',
                    colspan: 2,
                    align: 'center',
            	},
            	{
            		title: '地震灾害防治区划图（活动断层101m避让缓冲区）',
                    colspan: 2,
                    align: 'center',
            	},
            	{
            		title: '地震灾害防治区划图（活动断层201m避让缓冲区）',
                    colspan: 2,
                    align: 'center',
            	},
            	{
            		title: '活动断层位置误差',
                    colspan: 2,
                    align: 'center',
            	},
            	{
            		title: '50年超越概率63%地震作用下房屋直接经济损失等级图',
                    colspan: 2,
                    align: 'center',
            	},
            	{
            		title: '50年超越概率10%地震作用下房屋直接经济损失等级图',
                    colspan: 2,
                    align: 'center',
            	},
            	{
            		title: '50年超越概率2%地震作用下房屋直接经济损失等级图',
                    colspan: 2,
                    align: 'center',
            	},
            	{
            		title: '100年超越概率1%地震作用下房屋直接经济损失等级图',
                    colspan: 2,
                    align: 'center',
            	},
            	{
            		title: '50年超越概率63%地震作用下房屋破坏导致的死亡人口等级图',
                    colspan: 2,
                    align: 'center',
            	},
            	{
            		title: '50年超越概率10%地震作用下房屋破坏导致的死亡人口等级图',
                    colspan: 2,
                    align: 'center',
            	},
            	{
            		title: '50年超越概率2%地震作用下房屋破坏导致的死亡人口等级图',
                    colspan: 2,
                    align: 'center',
            	},
            	{
            		title: '100年超越概率1%地震作用下房屋破坏导致的死亡人口等级图',
                    colspan: 2,
                    align: 'center',
            	},
            	{
            		title: '50年超越概率63%地震作用下房屋直接经济损失评估图',
                    colspan: 2,
                    align: 'center',
            	},
            	{
            		title: '50年超越概率10%地震作用下房屋直接经济损失评估图',
                    colspan: 2,
                    align: 'center',
            	},
            	{
            		title: '50年超越概率2%地震作用下房屋直接经济损失评估图',
                    colspan: 2,
                    align: 'center',
            	},
            	{
            		title: '100年超越概率1%地震作用下房屋直接经济损失评估图',
                    colspan: 2,
                    align: 'center',
            	},
            	{
            		title: '50年超越概率63%地震作用下房屋破坏导致的死亡人口评估图',
                    colspan: 2,
                    align: 'center',
            	},
            	{
            		title: '50年超越概率10%地震作用下房屋破坏导致的死亡人口评估图',
                    colspan: 2,
                    align: 'center',
            	},
            	{
            		title: '50年超越概率2%地震作用下房屋破坏导致的死亡人口评估图',
                    colspan: 2,
                    align: 'center',
            	},
            	{
            		title: '100年超越概率1%地震作用下房屋破坏导致的死亡人口评估图',
                    colspan: 2,
                    width: '21%',
                    align: 'center',
            	},
            ],
            [
                {field: 'vulnerabilityVI36', title: '完成房屋调查面积(万平米)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
				    formatter:function(val,rowData,rowIndex){
				    	let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-1"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-1"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }

				    	
				   	}
			    },
                {field: 'vulnerability1', title: '比例 (％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
				    formatter:function(val,rowData,rowIndex){
				    	let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-1"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-1"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
                        
				    	
				    	
				   	}
			    },
                {field: 'vulnerabilityVIII37', title: '完成资料收集与汇交的项目数量(个)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
				    formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-2"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-2"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   	}
				},
                {field: 'vulnerability2', title: '完成资料收集与汇交的项目比例 (％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-2"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-2"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   	}
                },
                {field: 'vulnerabilityX38', title: '已完成汇交的分布图数量(幅)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-3"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-3"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerability3', title: '比例 (％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-3"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-3"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerabilityX39', title: '已完成汇交的分布图说明书(幅)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-6"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-6"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerability4', title: '比例 (％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-6"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-6"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerabilityX40', title: '已完成汇交的分布图成果报告(幅)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-7"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-7"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerability5', title: '比例 (％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-7"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-7"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerabilityX41', title: '完成资料收集的钻孔数量 (个)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-4"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-4"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerability6', title: '完成资料收集的钻孔比例 (％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-4"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-4"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerabilityX42', title: '已完成构造图数量(幅)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-5"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-5"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerability7', title: '编制构造图的工作进度(％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-5"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-5"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerabilityX43', title: '已完成构造图说明书数量', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-8"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-8"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerability8', title: '编制构造图说明书的工作进度(％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-8"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-8"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerabilityX44', title: '已完成构造图报告数量', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-9"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-9"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerability9', title: '编制构造图说明书的工作进度(％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-9"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-9"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerabilityX45', title: '完成数量（个）', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-10"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-10"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerability10', title: '比例 (％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-10"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-10"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerabilityX46', title: '完成数量（个）', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-11"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-11"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerability11', title: '比例 (％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-11"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-11"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerabilityX47', title: '完成数量（个）', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-12"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-12"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerability12', title: '比例 (％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-12"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-12"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerabilityX48', title: '房屋建筑物地震隐患评估图完成数量（个）', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-13"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-13"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerability13', title: '比例 (％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-13"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-13"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerabilityX49', title: '市政桥梁地震隐患评估图完成数量（个）', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-14"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-14"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerability14', title: '比例 (％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-14"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-14"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerabilityX50', title: '城市自来水厂地震隐患评估图完成数量（个）', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-15"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-15"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerability15', title: '比例 (％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-15"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-15"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerabilityX51', title: '完成数量（个）', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-16"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-16"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerability16', title: '比例 (％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-16"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-16"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerabilityX52', title: '完成数量（个）', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-17"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-17"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerability17', title: '比例 (％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-17"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-17"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerabilityX53', title: '完成数量（个）', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-18"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-18"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerability18', title: '比例 (％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-18"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-18"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerabilityX54', title: '完成数量（个）', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-19"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-19"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerability19', title: '比例 (％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-19"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-19"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerabilityX55', title: '完成数量（个）', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-20"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-20"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerability20', title: '比例 (％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-20"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-20"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerabilityX56', title: '完成数量（个）', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-21"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-21"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerability21', title: '比例 (％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-21"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-21"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerabilityX57', title: '完成数量（个）', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-22"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-22"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerability22', title: '比例 (％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-22"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-22"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerabilityX58', title: '完成数量（个）', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-23"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-23"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerability23', title: '比例 (％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-23"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-23"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerabilityX59', title: '完成数量（个）', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-24"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-24"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerability24', title: '比例 (％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-24"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-24"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerabilityX60', title: '完成数量（个）', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-25"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-25"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerability25', title: '比例 (％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-25"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-25"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerabilityX61', title: '完成数量（个）', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-26"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-26"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerability26', title: '比例 (％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-26"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-26"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerabilityX62', title: '完成数量（个）', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-27"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-27"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerability27', title: '比例 (％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-27"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-27"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerabilityX63', title: '完成数量（个）', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-28"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-28"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerability28', title: '比例 (％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-28"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-28"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerabilityX64', title: '完成数量（个）', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-29"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-29"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerability29', title: '比例 (％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-29"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-29"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerabilityX65', title: '完成数量（个）', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-30"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-30"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerability30', title: '比例 (％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-30"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-30"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerabilityX66', title: '完成数量（个）', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-31"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-31"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerability31', title: '比例 (％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-31"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-31"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerabilityX67', title: '完成数量（个）', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-32"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-32"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerability32', title: '比例 (％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-32"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-32"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerabilityX68', title: '完成数量（个）', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-33"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-33"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerability33', title: '比例 (％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-33"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-33"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerabilityX69', title: '完成数量（个）', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-34"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-34"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerability34', title: '比例 (％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-34"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-34"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerabilityX70', title: '完成数量（个）', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-35"){
                        		Value = subitem.quantity;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"1"}   data-taskCode = ${"41-35"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
               	{field: 'vulnerability35', title: '比例 (％)', width: '11%', align: 'center', editor:{type:'numberbox',options:{precision:2}},
                	formatter:function(val,rowData,rowIndex){
                        let dataList = rowData.dataVOS
                        let Value 
                        dataList.forEach(subitem => {
                        	//debugger;
                        	if(subitem.taskCode == "41-35"){
                        		Value = subitem.percentage;
                        	}
                            
                        })
                        if(content){
                        	return `<input type="number" class="form-control" onchange='keyup(this)' data-mark = ${"2"}  data-taskCode = ${"41-35"} data-divisionCode=${rowData.divisionCode} value=${Value}>`
                        }else{
                        	return Value
                        }
				   }
               	},
            ]],
            toolbar: [{
                iconCls: 'fa fa-upload',
                text: "导入",
                handler: function () {
                    importForm();
                }
            }, 
//          {
//              iconCls: 'fa fa-download',
//              text: "导出",
//              handler: function () {
//                  exportForm();
//              }
//          }
            ],
            //data:testData,
//          onClickCell: function (index, field, value) {
//              if (endEditing()) {
//                  $('#fxVulnerabilityAreaGrid').datagrid('selectRow', index).datagrid('editCell', {
//                      index: index,
//                      field: field
//                  });
//                  editIndex = index;                    
//              }
//          },
//          onDblClickCell: function (index, field, value) {
//				$("#fxVulnerabilityAreaGrid").datagrid('endEdit', index);
//				debugger;
//				mergeCells("fxVulnerabilityAreaGrid", "area,structureType");
//        	},
//          onAfterEdit: function (index, row, changes) {
////             $("#fxVulnerabilityAreaGrid").datagrid('endEdit', index);
////			    $.ajax({
////			        url : '要改变后台数据的controller路径?fieId1='+row.属性1,
////			        data:{fieId2:row.fieId}, //额外的参数
////			        dataType: "text",//响应结果为文本
////			        success:function (data) {
////			            $.messager.alert('消息', data);
////			        }
////			    });
//				//console.log(index, row, changes);
//              debugger
//              if (row.vulnerabilityVI == null && row.vulnerabilityVII == null
//                  && row.vulnerabilityVIII == null && row.vulnerabilityIX == null
//                  && row.vulnerabilityX == null){
//                  Util.alert("数据不能为空！");
//              }else {
//                  $.ajax({
//                      url: getFxVulnerabilityAreaController(),
//                      contentType: "application/json",
//                      data: JSON.stringify(row),
//                      type: "put",
//                      success: function (data) {
//                          Util.alert(data.message);
//                          createFxVulnerabilityAreaGrid();
//                      }
//                  });
//              }
//          },
            onLoadSuccess: function (data) {
            	var totalWidth = $(".datagrid-view2 .datagrid-htable").width()+20;
        		$(".datagrid-header-inner").css("width",totalWidth);
				$(".datagrid-footer-inner").css("width",totalWidth);
            	
//				var totalWidth = 0;
//				var columns = $("#fxVulnerabilityAreaGrid").datagrid("options").columns[0];
//				debugger;
//				for(var i = 0; i < columns.length;i++){
//				totalWidth += columns[i].width+10;
//				}
				
                //垂直合并单元格
                //mergeCells("fxVulnerabilityAreaGrid", "area,structureType");
            },
//          pagination: true,
//          pageSize: 10
        });
        
    };
    $.extend($.fn.datagrid.methods, {
        editCell: function (jq, param) {
            return jq.each(function () {
                var opts = $(this).datagrid('options');
                var fields = $(this).datagrid('getColumnFields', true).concat(
                    $(this).datagrid('getColumnFields'));
                for (var i = 0; i < fields.length; i++) {
                    var col = $(this).datagrid('getColumnOption', fields[i]);
                    col.editor1 = col.editor;
                    if (fields[i] != param.field) {
                        col.editor = null;
                    }
                }
                $(this).datagrid('beginEdit', param.index);
                for (var i = 0; i < fields.length; i++) {
                    var col = $(this).datagrid('getColumnOption', fields[i]);
                    col.editor = col.editor1;
                }
            });
        }
    });
    var editIndex = undefined;

    //结束编辑
    function endEditing() {
        if (editIndex == undefined) {
            return true
        }
        if ($('#fxVulnerabilityAreaGrid').datagrid('validateRow', editIndex)) {
            $('#fxVulnerabilityAreaGrid').datagrid('endEdit', editIndex);
            editIndex = undefined;
            return true;
        } else {
            return false;
        }
    };
    //合并单元格方法
    /**
     * EasyUI DataGrid根据字段动态合并单元格
     * @param colList 要合并table的id, 此例子中是tTable
     * @param colList 要合并的列,多个列用逗号分隔(例如："tempParam,flowCode,queryParam");
     */
    function mergeCells(tableID, colList) {
        var colArray = colList.split(",");
        var tTable = $("#" + tableID);
        var tableRows = tTable.datagrid("getRows");
        var tableRowCnts = tableRows.length;
        var rowspan;
        var preTxt = "";
        var curTxt = "";
        for (j = colArray.length - 1; j >= 0; j--) {
            preTxt = "";
            rowspan = 1;
            for (i = 0; i <= tableRowCnts; i++) {
                if (i == tableRowCnts) {
                    curTxt = "";
                } else {
                    curTxt = tableRows[i][colArray[j]];
                }
                if (preTxt == curTxt) {
                    rowspan += 1;
                } else {
                    tTable.datagrid("mergeCells", {
                        index: i - rowspan,
                        field: colArray[j],//合并字段
                        rowspan: rowspan,
                        colspan: null
                    });
                    rowspan = 1;
                }
                preTxt = curTxt;
            }
        }
    };
    var formValidator = function () {
        $("#fxVulnerabilityAreaForm").validate({
            rules: {
                area: {
                    required: true,
                },
                structureType: {
                    required: true,
                },
                damageDegree: {
                    required: true,
                },
                earthquakeIntensity: {
                    required: true,
                },
                vulnerability: {
                    required: true,
                },
            },
            messages: {
                area: {
                    required: "地区不允许为空!",
                },
                structureType: {
                    required: "结构类型不允许为空!",
                },
                damageDegree: {
                    required: "破坏程度不允许为空!",
                },
                earthquakeIntensity: {
                    required: "地震动强度不允许为空!",
                },
                vulnerability: {
                    required: "易损性不允许为空!",
                },
            }
        });
    };
    var getFxVulnerabilityArea = function (id) {
        $.ajax({
            url: getFxVulnerabilityAreaController() + "/" + id,
            type: "get",
            success: function (data) {
                Tool.deserialize("fxVulnerabilityAreaForm", data);
            }
        });
    };


    // 下载模板
    var downloadTemplate = function () {
        window.location.href = getServer() + "/excel/地区易损性模板.xlsx";
    };

    // 导入
    var importForm = function () {
        // 模板下载
        $("#uploadModal").modal();
        $("#uploadModal").on("shown.bs.modal", function () {
            var url = getServer() + "/excel/地震行业普查任务完成情况进度统计表.xlsx";
            $("#downloadZwExcelTemplate").attr("href", url);
        });

        $('#uploadButton').off("click");
        $("#uploadButton").on("click", function () {
            var uploadinput = document.getElementById("uploadFile");
            if (uploadinput.value == "") {
                Util.alert("上传前请先选择文件!");
                return;
            }
            var formData = new FormData();
            formData.append("file", uploadinput.files[0]);
            $.ajax({
                url: getController() + "/jobSchedule/importExcel",
                data: formData,
                processData: false, //因为data值是FormData对象，不需要对数据做处理。
                contentType: false,
                type: "POST",
                success: function (data) {
                    $('#uploadModal').modal('hide');
                    uploadinput.value = null;
                    Util.alert(data.message);
                    createFxVulnerabilityAreaGrid();
                }
            });
        });
    };


    // 导出
    var exportForm = function () {
        let area = $("#areaSelect").val();
        window.location.href = getFxVulnerabilityAreaController() + "/export?area=" + area;
    };

    window._editFxVulnerabilityArea = function (fxVulnerabilityAreaId) {
        var slidebar = Util.slidebar({
            url: fxVulnerabilityAreaFormHtml,
            width: "580px",
            cache: false,
            close: true,
            afterLoad: function () {                
                formValidator();
                getFxVulnerabilityArea(fxVulnerabilityAreaId);
                $("#saveBtn").on("click", function () {
                    if ($("#fxVulnerabilityAreaForm").valid()) {
                        var data = Tool.serialize("fxVulnerabilityAreaForm");
                        $.ajax({
                            url: getFxVulnerabilityAreaController(),
                            contentType: "application/json",
                            data: JSON.stringify(data),
                            type: "put",
                            success: function (data) {
                                Util.alert(data.message);
                                slidebar.close();
                                createFxVulnerabilityAreaGrid();
                            }
                        });
                    }
                });
            }
        });
    };
    var deleteFxVulnerabilityArea = function () {
        var rows = $("#fxVulnerabilityAreaGrid").datagrid("getSelections");
        if (rows == null || rows.length == 0) {
            Util.alert("请选择一行数据!");
            return;
        }
        Util.confirm("是否要删除选中的数据?", function () {
            var ids = "";
            $.each(rows, function (i, row) {
                ids += row.id + ",";

            });
            ids = ids.substr(0, ids.length - 1);
            $.ajax({
                url: getFxVulnerabilityAreaController(),
                data: {
                    ids: ids
                },
                type: "delete",
                success: function (data) {
                    createFxVulnerabilityAreaGrid();
                }
            });
        }, function () {
            return;
        });

    };

    return {
        init: init
    };
});
